Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

The EffectRenderFrame Function

The EffectRenderFrame function is called to actually render a single frame of your effect. This is where you transform the sources of your effect into the destination frame, using the algorithm that implements your effect.

This is also where you have to handle multiple bit depth and pixel format combinations.

Internally, QuickTime stores bitmaps in a wide variety of formats. The system can handle images in a number of bit depths and with many different pixel formats. Effect components must have some ability to handle source and destination frames that are at any of the bit depths and in any of the pixel formats that QuickTime supports.

Obviously, providing a separate implementation of your effect algorithm for every combination of bit depth and pixel format could be an enormous task. Fortunately, QuickTime provides mechanisms for you to limit the number of formats you have to explicitly support.

When your effect component's EffectSetup function is called, it is passed information about the bit depth and pixel formats that the source frames are in. Your component should examine the formats and react in one of two ways:

In the second case, where you do not directly support the format, QuickTime automatically creates buffers in the format returned by EffectSetup . The source frames are written into the buffer before EffectRenderFrame is called, so that source data is always available in a supported format. The destination frame is also buffered, and QuickTime automatically transforms the image into the required format for you.

This way, you only need to support a limited number of image formats, and QuickTime will ensure that EffectRenderFrame isn't called with data in any other format.

Note
If your effect does not handle the bit depth and pixel format combination passed to the Setup function, and it requests an alternative format, QuickTime generates new offscreen buffers for each source and destination frame your effect uses. This will result in a memory and execution time overhead for your effect. If you want your effect to execute quickly in a wide range of circumstances, your effect should explicitly handle as many bit depth and pixel format combinations as possible.


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |